/**
 * 文件名：ResourceController.java
 * 创建时间：Jul 8, 200912:56:58 PM
 */
package com.lane.sidecn.security.web;


import com.lane.core.web.BaseController;
import com.lane.sidecn.security.model.Resource;
import com.lane.sidecn.security.service.ResourceManager;

/**
 * @author 忽吉烈
 *
 */
public class ResourceController extends BaseController{

	private ResourceManager resourceManager;
	private Resource resource;
	
	/**
	 * 添加资源
	 */
	public void addResource()
	{
		try {
			resourceManager.save(resource);
			printMessage("addSuccess");
		} catch (Exception e) {
			e.printStackTrace();
			printMessage("addFail");
		}
		
	}
	
	/**
	 * 删除资源
	 */
	public void delResource()
	{
		resourceManager.removeById(resource.getResource_id());
		printMessage("delSuccess");
	}
	
	/**
	 * 更新资源
	 */
	public void updateResource()
	{
		try {
			resourceManager.save(resource);
			printMessage("updateSuccess");
		} catch (Exception e) {
			e.printStackTrace();
			printMessage("updateFail");
		}
	}
	
	public ResourceManager getResourceManager() {
		return resourceManager;
	}

	public void setResourceManager(ResourceManager resourceManager) {
		this.resourceManager = resourceManager;
	}

	public Resource getResource() {
		return resource;
	}

	public void setResource(Resource resource) {
		this.resource = resource;
	}
}
